#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    :  
# @function: 
# @version :


class Test:
    # 实例对象()会自动触发
    def __call__(self, *args, **kwargs):
        print('这是一个回调魔术方法...')


class Logging:
    def __init__(self, func):
        # 将接收到的函数地址作为一个实例属性
        self.func = func

    def __call__(self, *args, **kwargs):
        print(f'当前函数的名称为：{self.func.__name__}')
        return self.func(*args, **kwargs)


@Logging  # Logging(send_message)
def send_message(message):
    print(f'发送的信息为：{message}')


send_message('今天天气不错')

